//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.yuebanmaoshare.file.common.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtil {
    public static String replaceBlank(String str) {
        String intro = str.replaceAll("\\t", "");
        intro = intro.replaceAll("> +", ">");
        intro = intro.replaceAll(" +<", "<");
        return intro;
    }

    public static String formatMdContent(String str) {
        String intro = str.replaceAll("#+ ", "");
        intro = intro.replaceAll("> ", "");
        intro = intro.replaceAll("!\\[(.+)\\]\\((.+)\\)", "");
        intro = intro.replaceAll("\\*\\*", "");
        intro = intro.replaceAll("\\r\\n", "");
        intro = intro.replaceAll("\\r", "");
        intro = intro.replaceAll("\\n", "");
        intro = intro.replaceAll("\\t", "");
        return intro;
    }

    public static int getChildStrCount(String childStr, String parentStr) {
        String input = "nihaoksdoksad";
        String target = "ok";
        int count = 0;

        for(Matcher e = Pattern.compile(Pattern.quote(childStr)).matcher(parentStr); e.find(); ++count) {
        }

        return count;
    }
}
